/**
* 左边菜单
*/ 
<template>
<!-- eslint-disable -->
  <!-- <div class="menuBox">
    <div class="logobox">
      <img  class="logoimg" :src="backImg" alt="" />
    </div> -->
    <el-menu
      default-active="2"
      :collapse="collapsed"
      collapse-transition
      router
      unique-opened
      class="el-menu-vertical-demo"
      background-color="#334157"
      text-color="#fff"
      active-text-color="#ffd04b"
      :default-active="$route.path">
      <el-submenu
        v-for="menu in allmenu"
        :key="menu.id"
        :index="menu.title">
        <template slot="title">
          <i class="iconfont mr8" :class="menu.icon"></i>
          <span>{{ menu.title }}</span>
        </template>
        <el-menu-item-group>
          <el-menu-item
            v-for="chmenu in menu.sub_menus"
            :index="'/' + chmenu.route"
            :key="chmenu.id">
            <i class="iconfont mr8" :class="chmenu.icon"></i>
            <span>{{ chmenu.title }}</span>
          </el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
</template>
<script>
import {mapState} from 'vuex'
export default {
  name: "leftnav",
  data() {
    return {
      allmenu: [],
    };
  },
  computed:{
    ...mapState(['collapsed','rightList']),
  },
  // 创建完毕状态(里面是操作)
  created() {
    this.allmenu = this.rightList;
  },
};
</script>
<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 240px;
  min-height: 400px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  border: none;
  text-align: left;
}
.el-menu-item-group__title {
  padding: 0px;
}
.el-menu-bg {
  background-color: #1f2d3d !important;
}
.el-menu {
  border: none;
  flex:1;
}
.el-menu--popup-right-start{
  max-height: 100vh;
  overflow-y:auto ;
}
.el-menu--popup-right-start::-webkit-scrollbar {
    /*滚动条整体样式*/
    width: 10px;
    /*高宽分别对应横竖滚动条的尺寸*/
    height: 1px;
}

.el-menu--popup-right-start::-webkit-scrollbar-thumb {
    /*滚动条里面小方块*/
    border-radius: 10px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    background: #909399;
}

.el-menu--popup-right-start::-webkit-scrollbar-track {
    /*滚动条里面轨道*/
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    background: #e8e8e8;
}

</style>